package com.yundian.hibernate;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;

import com.yundian.user.vo.User;

public class testHibernate {
	
	public static void main(String[] args) {
		Configuration configuration=new Configuration().configure();
		SessionFactory sessionFactory=configuration.buildSessionFactory();
		Session session=sessionFactory.openSession();
		Transaction tx=session.beginTransaction();
		
		
		User user=new User();
		user.setAge(Integer.valueOf(1));
		user.setUsername("liulxiang");
		user.setPassword("hellowordl");
		
		
		
		
		session.save(user);
		tx.commit();
		session.close();
		sessionFactory.close();
	}

}
